/* 富文本内容全局样式 */
:root {
  /* 富文本颜色变量 - 浅色模式 */
  --rich-text-primary: #1a1a1a;
  --rich-text-secondary: #4a5568;
  --rich-text-accent: #3182ce;
  --rich-text-background: #ffffff;
  --rich-text-background-secondary: #f7fafc;
  --rich-text-border: #e2e8f0;
  --rich-text-code-bg: #f8f9fa;
  --rich-text-quote-border: #3182ce;

  /* 字体变量 */
  --font-code: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* 深色主题颜色变量 - 优化版 */
[data-theme='dark'] {
  --rich-text-primary: #e8e8e8; /* 主文本 */
  --rich-text-secondary: #b0b0b0; /* 次要文本 - 提高对比度 */
  --rich-text-accent: #81d4fa; /* 链接色 - 更亮的蓝色 */
  --rich-text-background: #0f0f0f; /* 背景 - 与主题一致 */
  --rich-text-background-secondary: #1a1a1a; /* 次背景 */
  --rich-text-border: rgba(255, 255, 255, 0.1); /* 边框 */
  --rich-text-code-bg: #1e1e1e; /* 代码块背景 */
  --rich-text-quote-border: #81d4fa; /* 引用边框 */
}

/* 富文本内容专用样式 - 同时应用于显示(.rich-text-content)和编辑(.ProseMirror) */
.rich-text-content,
.ProseMirror {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  color: var(--rich-text-primary);

  /* 确保内容在所有容器中的正确显示 */
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

/* 深色模式富文本容器增强 */
[data-theme='dark'] .rich-text-content,
[data-theme='dark'] .ProseMirror {
  color: #e8e8e8;
}

/* ========== 代码块样式 - 统一编辑器和渲染器 ========== */

/* 代码块容器 - 应用于编辑器和渲染器 */
.rich-text-content pre,
.ProseMirror pre {
  background: var(--rich-text-code-bg);
  border: 1px solid var(--rich-text-border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  font-family: var(--font-code);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre;
  position: relative;
}

/* 代码块内的代码元素 */
.rich-text-content pre code,
.ProseMirror pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: inherit;
  font-family: inherit;
  color: var(--rich-text-primary);
  white-space: pre;
  display: block;
  width: 100%;
}

/* 深色模式 - 代码块优化 */
[data-theme='dark'] .rich-text-content pre,
[data-theme='dark'] .ProseMirror pre {
  background: #1a1a1a;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-theme='dark'] .rich-text-content pre code,
[data-theme='dark'] .ProseMirror pre code {
  color: #d4d4d4 !important; /* 更亮的默认代码色 */
}

/* 确保语法高亮的颜色不被覆盖 */
[data-theme='dark'] .rich-text-content pre code *,
[data-theme='dark'] .ProseMirror pre code * {
  color: inherit;
}

/* 内联代码样式 */
.rich-text-content code,
.ProseMirror code {
  font-family: var(--font-code);
  background: var(--rich-text-code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
  color: #e83e8c;
  border: 1px solid var(--rich-text-border);
}

/* 深色模式 - 内联代码优化 */
[data-theme='dark'] .rich-text-content code,
[data-theme='dark'] .ProseMirror code {
  background: rgba(129, 212, 250, 0.12); /* 使用主题色的半透明背景 */
  color: #81d4fa; /* 明亮的蓝色 */
  text-shadow: 0 0 8px rgba(129, 212, 250, 0.3); /* 微光效果 */
}

/* 语法高亮颜色 - 浅色模式（默认） */
.hljs-keyword {
  color: #d73a49 !important;
}
.hljs-string {
  color: #032f62 !important;
}
.hljs-comment {
  color: #6a737d !important;
}
.hljs-function {
  color: #6f42c1 !important;
}
.hljs-number {
  color: #005cc5 !important;
}
.hljs-title {
  color: #6f42c1 !important;
}
.hljs-params {
  color: #24292e !important;
}
.hljs-built_in {
  color: #005cc5 !important;
}
.hljs-variable {
  color: #e36209 !important;
}
.hljs-attr {
  color: #005cc5 !important;
}
.hljs-property {
  color: #005cc5 !important;
}
.hljs-literal {
  color: #005cc5 !important;
}
.hljs-operator {
  color: #d73a49 !important;
}

/* 语法高亮颜色 - 深色模式 */
[data-theme='dark'] .hljs-keyword {
  color: #c678dd !important;
}
[data-theme='dark'] .hljs-string {
  color: #98c379 !important;
}
[data-theme='dark'] .hljs-comment {
  color: #7f848e !important;
}
[data-theme='dark'] .hljs-function {
  color: #61afef !important;
}
[data-theme='dark'] .hljs-number {
  color: #d19a66 !important;
}
[data-theme='dark'] .hljs-title {
  color: #61afef !important;
}
[data-theme='dark'] .hljs-params {
  color: #abb2bf !important;
}
[data-theme='dark'] .hljs-built_in {
  color: #e5c07b !important;
}
[data-theme='dark'] .hljs-variable {
  color: #e06c75 !important;
}
[data-theme='dark'] .hljs-attr {
  color: #d19a66 !important;
}
[data-theme='dark'] .hljs-property {
  color: #61afef !important;
}
[data-theme='dark'] .hljs-literal {
  color: #56b6c2 !important;
}
[data-theme='dark'] .hljs-operator {
  color: #56b6c2 !important;
}
[data-theme='dark'] .hljs-type {
  color: #e5c07b !important;
}
[data-theme='dark'] .hljs-name {
  color: #e06c75 !important;
}
[data-theme='dark'] .hljs-tag {
  color: #abb2bf !important;
}
[data-theme='dark'] .hljs-punctuation {
  color: #abb2bf !important;
}
[data-theme='dark'] .hljs-subst {
  color: #e06c75 !important;
}
[data-theme='dark'] .hljs-class {
  color: #e5c07b !important;
}
[data-theme='dark'] .hljs-title.class_ {
  color: #e5c07b !important;
}
[data-theme='dark'] .hljs-title.function_ {
  color: #61afef !important;
}
[data-theme='dark'] .hljs-variable.language_ {
  color: #e06c75 !important;
}
[data-theme='dark'] .hljs-variable.constant_ {
  color: #d19a66 !important;
}

/* 引用块样式 */
.rich-text-content blockquote,
.ProseMirror blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid var(--rich-text-quote-border);
  background: var(--rich-text-background-secondary);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  position: relative;
  color: var(--rich-text-secondary);
}

/* 深色模式引用块优化 */
[data-theme='dark'] .rich-text-content blockquote,
[data-theme='dark'] .ProseMirror blockquote {
  background: rgba(129, 212, 250, 0.08);
  border-left: 4px solid #81d4fa;
  color: #b0b0b0;
  box-shadow:
    inset 3px 0 8px rgba(129, 212, 250, 0.15),
    0 2px 8px rgba(0, 0, 0, 0.3);
}

.rich-text-content blockquote p,
.ProseMirror blockquote p {
  margin: 0.5rem 0;
}

.rich-text-content blockquote p:first-of-type,
.ProseMirror blockquote p:first-of-type {
  margin-top: 0;
}

.rich-text-content blockquote p:last-child,
.ProseMirror blockquote p:last-child {
  margin-bottom: 0;
}

/* 图片样式 - 基础样式 */
/* 排除 ImagePreview 组件的图片（通过类名识别） */
.rich-text-content img:not(.image-preview-img),
.ProseMirror img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem 0;
  display: block;
  object-fit: contain;
}

/* 移动端图片强制自适应 */
/* 排除 ImagePreview 组件的图片 */
@media (max-width: 768px) {
  .rich-text-content img:not(.image-preview-img),
  .ProseMirror img {
    width: 100% !important;
    height: auto !important;
  }
}

/* 可调整大小的图片容器 */
.ProseMirror .resizable-image-wrapper {
  width: 100%;
  margin: 1.5rem 0;
  position: relative;
  display: flex;
  justify-content: center;
}

.ProseMirror .resizable-image-wrapper[data-align='left'] {
  justify-content: flex-start;
}

.ProseMirror .resizable-image-wrapper[data-align='right'] {
  justify-content: flex-end;
}

.ProseMirror .resizable-image-wrapper[data-align='center'] {
  justify-content: center;
}

.ProseMirror .resizable-image-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
  user-select: none;
}

.ProseMirror .resizable-image-container img {
  display: block;
  max-width: 100%;
  height: auto !important; /* 确保高度可以被 JS 修改 */
  border-radius: 8px;
  cursor: default;
  transition: none; /* 移除过渡以避免调整时的延迟 */
  pointer-events: auto;
}

/* 调整大小手柄 - 增强可见性和交互性 */
.ProseMirror .resize-handle {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 24px;
  height: 24px;
  background: var(--accent-color);
  border: 3px solid #fff;
  border-radius: 50%;
  cursor: nwse-resize;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  pointer-events: auto !important; /* 确保可以点击 */
}

[data-theme='dark'] .ProseMirror .resize-handle {
  border-color: #1a1a1a;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.ProseMirror .resizable-image-container:hover .resize-handle,
.ProseMirror .resizable-image-wrapper.resizing .resize-handle {
  opacity: 1;
  transform: scale(1.1);
}

.ProseMirror .resize-handle:hover {
  background: var(--accent-color);
  transform: scale(1.2) !important;
  box-shadow: 0 4px 12px rgba(var(--accent-rgb, 81, 131, 245), 0.4);
}

/* 图片工具栏 */
.ProseMirror .image-toolbar {
  position: absolute;
  top: -45px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 100;
  white-space: nowrap;
}

[data-theme='dark'] .ProseMirror .image-toolbar {
  background: #1a1a1a;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.ProseMirror .resizable-image-container:hover .image-toolbar {
  opacity: 1;
  pointer-events: all;
}

.ProseMirror .toolbar-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-primary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.ProseMirror .toolbar-btn:hover {
  background: rgba(var(--accent-rgb, 81, 131, 245), 0.12);
  color: var(--accent-color);
  transform: scale(1.05);
}

.ProseMirror .toolbar-btn:active {
  transform: scale(0.95);
}

.ProseMirror .toolbar-btn svg {
  width: 16px;
  height: 16px;
}

/* 调整大小时的样式 */
.ProseMirror .resizable-image-wrapper.resizing .resizable-image-container {
  outline: 2px dashed var(--accent-color);
  outline-offset: 4px;
  opacity: 0.9;
}

.ProseMirror .resizable-image-wrapper.resizing img {
  pointer-events: none;
  user-select: none;
  transition: none !important;
  will-change: width, height;
}

/* 链接样式 */
.rich-text-content a,
.ProseMirror a {
  color: var(--rich-text-accent);
  text-decoration: underline;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.rich-text-content a:hover,
.ProseMirror a:hover {
  opacity: 0.8;
}

/* 标题样式 */
.rich-text-content h1,
.rich-text-content h2,
.rich-text-content h3,
.rich-text-content h4,
.rich-text-content h5,
.rich-text-content h6,
.ProseMirror h1,
.ProseMirror h2,
.ProseMirror h3,
.ProseMirror h4,
.ProseMirror h5,
.ProseMirror h6 {
  color: var(--rich-text-primary);
  font-weight: 600;
  line-height: 1.3;
  margin: 2rem 0 1rem;
}

/* 深色模式标题增强 */
[data-theme='dark'] .rich-text-content h1,
[data-theme='dark'] .rich-text-content h2,
[data-theme='dark'] .rich-text-content h3,
[data-theme='dark'] .rich-text-content h4,
[data-theme='dark'] .rich-text-content h5,
[data-theme='dark'] .rich-text-content h6,
[data-theme='dark'] .ProseMirror h1,
[data-theme='dark'] .ProseMirror h2,
[data-theme='dark'] .ProseMirror h3,
[data-theme='dark'] .ProseMirror h4,
[data-theme='dark'] .ProseMirror h5,
[data-theme='dark'] .ProseMirror h6 {
  color: #f0f0f0;
}

.rich-text-content h1,
.ProseMirror h1 {
  font-size: 2.5em;
  margin-top: 0;
}

.rich-text-content h2,
.ProseMirror h2 {
  font-size: 2em;
}

.rich-text-content h3,
.ProseMirror h3 {
  font-size: 1.5em;
}

.rich-text-content h4,
.ProseMirror h4 {
  font-size: 1.25em;
}

.rich-text-content h5,
.rich-text-content h6,
.ProseMirror h5,
.ProseMirror h6 {
  font-size: 1.1em;
}

/* 段落样式 */
.rich-text-content p,
.ProseMirror p {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--rich-text-secondary);
  line-height: 1.8;
}

/* 只有编辑器中的段落需要最小高度，避免光标定位问题 */
.ProseMirror p {
  min-height: 1.5em;
}

/* 空段落不占用空间 */
.rich-text-content p:empty {
  display: none;
}

.rich-text-content p:last-child,
.ProseMirror p:last-child {
  margin-bottom: 0;
}

/* 深色模式段落增强 */
[data-theme='dark'] .rich-text-content p,
[data-theme='dark'] .ProseMirror p {
  color: #d4d4d4;
}

/* 列表样式 */
.rich-text-content ul,
.rich-text-content ol,
.ProseMirror ul,
.ProseMirror ol {
  padding-left: 2em;
  margin: 1.5rem 0;
}

.rich-text-content li,
.ProseMirror li {
  margin: 0.5em 0;
  color: var(--rich-text-secondary);
  line-height: 1.8;
}

.rich-text-content li p,
.ProseMirror li p {
  margin: 0.25rem 0;
}

/* 深色模式列表增强 */
[data-theme='dark'] .rich-text-content li,
[data-theme='dark'] .ProseMirror li {
  color: #d4d4d4;
}

/* 分割线样式 */
.rich-text-content hr,
.ProseMirror hr {
  border: none;
  height: 2px;
  background: var(--rich-text-border);
  margin: 2em 0;
}

/* 删除线样式 */
.rich-text-content s,
.ProseMirror s {
  text-decoration: line-through;
  color: var(--rich-text-secondary);
}

/* 高亮样式 */
.rich-text-content mark,
.ProseMirror mark {
  background: #fef08a;
  color: #000;
  padding: 0.1em 0.2em;
  border-radius: 3px;
}

[data-theme='dark'] .rich-text-content mark,
[data-theme='dark'] .ProseMirror mark {
  background: rgba(244, 196, 48, 0.3); /* 半透明金黄色 */
  color: #f4c430;
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(244, 196, 48, 0.4); /* 发光效果 */
}

/* 滚动条样式 */
.rich-text-content pre::-webkit-scrollbar,
.ProseMirror pre::-webkit-scrollbar {
  height: 8px;
}

.rich-text-content pre::-webkit-scrollbar-track,
.ProseMirror pre::-webkit-scrollbar-track {
  background: var(--rich-text-background-secondary);
  border-radius: 4px;
}

.rich-text-content pre::-webkit-scrollbar-thumb,
.ProseMirror pre::-webkit-scrollbar-thumb {
  background: var(--rich-text-border);
  border-radius: 4px;
}

.rich-text-content pre::-webkit-scrollbar-thumb:hover,
.ProseMirror pre::-webkit-scrollbar-thumb:hover {
  background: var(--rich-text-accent);
}

/* 打印样式 */
@media print {
  .rich-text-content,
  .ProseMirror {
    color: #000 !important;
    background: #fff !important;
  }

  .rich-text-content pre,
  .ProseMirror pre {
    background: #f8f9fa !important;
    border: 1px solid #ccc !important;
  }

  .rich-text-content blockquote,
  .ProseMirror blockquote {
    background: #f8f9fa !important;
    border-left: 4px solid #ccc !important;
  }

  .rich-text-content a,
  .ProseMirror a {
    color: #000 !important;
    text-decoration: underline !important;
  }
}

/* 可访问性增强 */
@media (prefers-reduced-motion: reduce) {
  .rich-text-content *,
  .ProseMirror * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 移动端 */
@media (max-width: 480px) {
  .rich-text-content,
  .ProseMirror {
    font-size: 15px;
    line-height: 1.7;
  }

  .rich-text-content h1,
  .ProseMirror h1 {
    font-size: 1.8em;
  }

  .rich-text-content h2,
  .ProseMirror h2 {
    font-size: 1.6em;
  }

  .rich-text-content h3,
  .ProseMirror h3 {
    font-size: 1.3em;
  }

  .rich-text-content h4,
  .ProseMirror h4 {
    font-size: 1.15em;
  }

  .rich-text-content h5,
  .rich-text-content h6,
  .ProseMirror h5,
  .ProseMirror h6 {
    font-size: 1em;
  }

  .rich-text-content p,
  .ProseMirror p {
    font-size: 15px;
    line-height: 1.75;
    margin-bottom: 1.25rem;
  }

  .ProseMirror pre {
    font-size: 13px;
  }

  .rich-text-content ul,
  .rich-text-content ol,
  .ProseMirror ul,
  .ProseMirror ol {
    padding-left: 1.4em;
  }

  .rich-text-content blockquote,
  .ProseMirror blockquote {
    padding: 0.75rem 1rem;
  }
}

/* ===== 表格样式 ===== */

/* 表格外层包装 - 提供横向滚动 */
.rich-text-content > table,
.ProseMirror > table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* iOS 流畅滚动 */
}

/* 表格本身 */
.rich-text-content table,
.ProseMirror table {
  border-collapse: collapse;
  table-layout: auto; /* 改为 auto 以适应移动端 */
  width: 100%;
  margin: 2rem 0;
  border-radius: 8px;
  border: 1px solid var(--rich-text-border);
  background: var(--rich-text-background);
}

[data-theme='dark'] .rich-text-content table,
[data-theme='dark'] .ProseMirror table {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
}

.rich-text-content td,
.rich-text-content th,
.ProseMirror td,
.ProseMirror th {
  min-width: 1em;
  border: 1px solid var(--rich-text-border);
  padding: 0.75rem 1rem;
  vertical-align: top;
  box-sizing: border-box;
  position: relative;
  color: var(--rich-text-secondary);
}

[data-theme='dark'] .rich-text-content td,
[data-theme='dark'] .rich-text-content th,
[data-theme='dark'] .ProseMirror td,
[data-theme='dark'] .ProseMirror th {
  border-color: rgba(255, 255, 255, 0.1);
  color: #d4d4d4;
}

.rich-text-content th,
.ProseMirror th {
  font-weight: 600;
  text-align: left;
  background: var(--rich-text-background-secondary);
  color: var(--rich-text-primary);
}

[data-theme='dark'] .rich-text-content th,
[data-theme='dark'] .ProseMirror th {
  background: rgba(129, 212, 250, 0.08);
  color: #f0f0f0;
}

/* 表格单元格选中状态 */
.ProseMirror .selectedCell:after {
  z-index: 2;
  position: absolute;
  content: '';
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: rgba(var(--accent-rgb, 81, 131, 245), 0.1);
  pointer-events: none;
}

/* 表格列调整大小手柄 */
.ProseMirror .column-resize-handle {
  position: absolute;
  right: -2px;
  top: 0;
  bottom: 0;
  width: 4px;
  z-index: 20;
  background-color: var(--accent-color);
  cursor: col-resize;
  opacity: 0;
}

.ProseMirror .column-resize-handle:hover {
  opacity: 1;
}

/* ===== 任务列表样式 ===== */
.rich-text-content ul[data-type='taskList'],
.ProseMirror ul[data-type='taskList'] {
  list-style: none;
  padding-left: 0;
  margin: 1.5rem 0;
}

.rich-text-content li[data-type='taskItem'],
.ProseMirror li[data-type='taskItem'] {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0.5rem 0;
}

.rich-text-content li[data-type='taskItem'] > label,
.ProseMirror li[data-type='taskItem'] > label {
  display: flex;
  align-items: center;
  user-select: none;
  flex-shrink: 0;
  margin-top: 0.2em;
}

.rich-text-content li[data-type='taskItem'] > label input[type='checkbox'],
.ProseMirror li[data-type='taskItem'] > label input[type='checkbox'] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--rich-text-border);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  margin: 0;
  flex-shrink: 0;
  transition: all 0.2s ease;
  background: var(--rich-text-background);
}

[data-theme='dark'] .rich-text-content li[data-type='taskItem'] > label input[type='checkbox'],
[data-theme='dark'] .ProseMirror li[data-type='taskItem'] > label input[type='checkbox'] {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.rich-text-content li[data-type='taskItem'] > label input[type='checkbox']:hover,
.ProseMirror li[data-type='taskItem'] > label input[type='checkbox']:hover {
  border-color: var(--accent-color);
}

.rich-text-content li[data-type='taskItem'] > label input[type='checkbox']:checked,
.ProseMirror li[data-type='taskItem'] > label input[type='checkbox']:checked {
  background: var(--accent-color);
  border-color: var(--accent-color);
}

.rich-text-content li[data-type='taskItem'] > label input[type='checkbox']:checked::after,
.ProseMirror li[data-type='taskItem'] > label input[type='checkbox']:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.rich-text-content li[data-type='taskItem'] > div,
.ProseMirror li[data-type='taskItem'] > div {
  flex: 1;
  min-width: 0;
}

/* 已完成任务的文字样式 */
.rich-text-content li[data-type='taskItem'][data-checked='true'] > div,
.ProseMirror li[data-type='taskItem'][data-checked='true'] > div {
  color: var(--rich-text-secondary);
  opacity: 0.6;
}

.rich-text-content li[data-type='taskItem'][data-checked='true'] > div p,
.ProseMirror li[data-type='taskItem'][data-checked='true'] > div p {
  text-decoration: line-through;
}

/* 嵌套任务列表 */
.rich-text-content li[data-type='taskItem'] ul[data-type='taskList'],
.ProseMirror li[data-type='taskItem'] ul[data-type='taskList'] {
  margin-top: 0.5rem;
  margin-left: 1.5rem;
}

/* 渲染模式下禁用复选框交互（保持视觉效果） */
.rich-text-content li[data-type='taskItem'] > label input[type='checkbox'] {
  pointer-events: none; /* 禁用点击 */
  cursor: default;
}

/* ===== 文字颜色样式 ===== */
/* 文字颜色由内联样式控制，无需额外CSS */

/* ===== 高亮标记样式 ===== */
.rich-text-content mark[data-color],
.ProseMirror mark[data-color] {
  padding: 0.1em 0.2em;
  border-radius: 3px;
}

/* 深色模式高亮优化 */
[data-theme='dark'] .rich-text-content mark[data-color],
[data-theme='dark'] .ProseMirror mark[data-color] {
  filter: brightness(0.8);
}

/* ===== 上标下标样式 ===== */
.rich-text-content sub,
.rich-text-content sup,
.ProseMirror sub,
.ProseMirror sup {
  font-size: 0.75em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

.rich-text-content sup,
.ProseMirror sup {
  top: -0.5em;
}

.rich-text-content sub,
.ProseMirror sub {
  bottom: -0.25em;
}
